export enum TRIGGER_TYPES {
  FEATURES_ANNOUNCEMENT = 'features_announcement',
  METAMASK_SWAP_COMPLETED = 'metamask_swap_completed',
  ERC20_SENT = 'erc20_sent',
  ERC20_RECEIVED = 'erc20_received',
  ETH_SENT = 'eth_sent',
  ETH_RECEIVED = 'eth_received',
  ROCKETPOOL_STAKE_COMPLETED = 'rocketpool_stake_completed',
  ROCKETPOOL_UNSTAKE_COMPLETED = 'rocketpool_unstake_completed',
  LIDO_STAKE_COMPLETED = 'lido_stake_completed',
  LIDO_WITHDRAWAL_REQUESTED = 'lido_withdrawal_requested',
  LIDO_WITHDRAWAL_COMPLETED = 'lido_withdrawal_completed',
  LIDO_STAKE_READY_TO_BE_WITHDRAWN = 'lido_stake_ready_to_be_withdrawn',
  ERC721_SENT = 'erc721_sent',
  ERC721_RECEIVED = 'erc721_received',
  ERC1155_SENT = 'erc1155_sent',
  ERC1155_RECEIVED = 'erc1155_received',
}

export enum TRIGGER_TYPES_GROUPS {
  RECEIVED = 'received',
  SENT = 'sent',
  DEFI = 'defi',
}

export const NOTIFICATION_CHAINS = {
  ETHEREUM: '1',
  OPTIMISM: '10',
  BSC: '56',
  POLYGON: '137',
  ARBITRUM: '42161',
  AVALANCHE: '43114',
  LINEA: '59144',
};

export const SUPPORTED_CHAINS = [
  NOTIFICATION_CHAINS.ETHEREUM,
  NOTIFICATION_CHAINS.OPTIMISM,
  NOTIFICATION_CHAINS.BSC,
  NOTIFICATION_CHAINS.POLYGON,
  NOTIFICATION_CHAINS.ARBITRUM,
  NOTIFICATION_CHAINS.AVALANCHE,
  NOTIFICATION_CHAINS.LINEA,
];

export type Trigger = {
  supported_chains: (typeof SUPPORTED_CHAINS)[number][];
};

type OnChainTriggerTypes = Exclude<
  TRIGGER_TYPES,
  TRIGGER_TYPES.FEATURES_ANNOUNCEMENT
>;

export const TRIGGERS: Record<OnChainTriggerTypes, Trigger> = {
  [TRIGGER_TYPES.METAMASK_SWAP_COMPLETED]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.OPTIMISM,
      NOTIFICATION_CHAINS.BSC,
      NOTIFICATION_CHAINS.POLYGON,
      NOTIFICATION_CHAINS.ARBITRUM,
      NOTIFICATION_CHAINS.AVALANCHE,
    ],
  },
  [TRIGGER_TYPES.ERC20_SENT]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.OPTIMISM,
      NOTIFICATION_CHAINS.BSC,
      NOTIFICATION_CHAINS.POLYGON,
      NOTIFICATION_CHAINS.ARBITRUM,
      NOTIFICATION_CHAINS.AVALANCHE,
      NOTIFICATION_CHAINS.LINEA,
    ],
  },
  [TRIGGER_TYPES.ERC20_RECEIVED]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.OPTIMISM,
      NOTIFICATION_CHAINS.BSC,
      NOTIFICATION_CHAINS.POLYGON,
      NOTIFICATION_CHAINS.ARBITRUM,
      NOTIFICATION_CHAINS.AVALANCHE,
      NOTIFICATION_CHAINS.LINEA,
    ],
  },
  [TRIGGER_TYPES.ERC721_SENT]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.POLYGON,
    ],
  },
  [TRIGGER_TYPES.ERC721_RECEIVED]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.POLYGON,
    ],
  },
  [TRIGGER_TYPES.ERC1155_SENT]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.POLYGON,
    ],
  },
  [TRIGGER_TYPES.ERC1155_RECEIVED]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.POLYGON,
    ],
  },
  [TRIGGER_TYPES.ETH_SENT]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.OPTIMISM,
      NOTIFICATION_CHAINS.BSC,
      NOTIFICATION_CHAINS.POLYGON,
      NOTIFICATION_CHAINS.ARBITRUM,
      NOTIFICATION_CHAINS.AVALANCHE,
      NOTIFICATION_CHAINS.LINEA,
    ],
  },
  [TRIGGER_TYPES.ETH_RECEIVED]: {
    supported_chains: [
      NOTIFICATION_CHAINS.ETHEREUM,
      NOTIFICATION_CHAINS.OPTIMISM,
      NOTIFICATION_CHAINS.BSC,
      NOTIFICATION_CHAINS.POLYGON,
      NOTIFICATION_CHAINS.ARBITRUM,
      NOTIFICATION_CHAINS.AVALANCHE,
      NOTIFICATION_CHAINS.LINEA,
    ],
  },
  [TRIGGER_TYPES.ROCKETPOOL_STAKE_COMPLETED]: {
    supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],
  },
  [TRIGGER_TYPES.ROCKETPOOL_UNSTAKE_COMPLETED]: {
    supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],
  },
  [TRIGGER_TYPES.LIDO_STAKE_COMPLETED]: {
    supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],
  },
  [TRIGGER_TYPES.LIDO_WITHDRAWAL_REQUESTED]: {
    supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],
  },
  [TRIGGER_TYPES.LIDO_WITHDRAWAL_COMPLETED]: {
    supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],
  },
  [TRIGGER_TYPES.LIDO_STAKE_READY_TO_BE_WITHDRAWN]: {
    supported_chains: [NOTIFICATION_CHAINS.ETHEREUM],
  },
};
